<!DOCTYPE html>
<!--鼠标双击事件-->
<html lang="en" ondblclick="ff()">
<head>
    <meta charset="UTF-8">
    <title>js练习</title>
</head>
<body>
    <button id="bu" >点我</button><br>
    <p>我是段落</p><br>
    <select id="se">
        <option>请选择饮料</option>
        <option>肥宅快乐水</option>
        <option id="op" VALUE="茶几">水溶C</option>
    </select>
</body>
</html>
<!--外部方式导入script-->
<script src="myjs.js">
</script>
<script>
    function ff(){
        alert("永远滴神")
    }
    //属性添加的方式建立onclick=fu1()
    document.getElementById("bu").setAttribute("onclick","fu1()");
    //方法,方法可以重名,就近原则
    let f=function() {

    }
    function fu1() {
        alert("马踏飞箭777")
    }
    //四个输入输出语句
    /*alert("谁敢横刀立马,唯我虎大将军")
    document.write("我在点我的后面?")
    prompt("请输入信息")
    console.log("给控制台的信息")*/
    //定义常量变量
    const mm=65;
    let i,j,k;
    i = 10;
    j="100";
    //数组
    k=[1,"20"];
    alert("10"-"20");
    document.write(typeof(k)+"<br>");
    document.write(k.length);
    document.write("<br>=============<br>");
    //语句
    let month=5;
    switch(month){
        case 3:
        case 4:
        case 5:
            document.write("春季");
            break;
        case 6:
        case 7:
        case 8:
            document.write("夏季");
            break;
        case 9:
        case 10:
        case 11:
            document.write("秋季");
            break;
        case 12:
        case 1:
        case 2:
            document.write("冬季");
            break;
        default:
            document.write("月份有误");
            break;
    }
    document.write("<br>");
    // 通过tagname更改文本内容
    document.getElementsByTagName("P")[0].innerHTML="更改文本内容";
    //添加option属性给select
    let opel = document.createElement("option");
    opel.innerText="冰红茶";
    let seel = document.getElementById("se");
    seel.appendChild(opel);
    //更改id为op的文本文档及获取文本文档和value值
    let opeel = document.getElementById("op");
    opeel.innerText="矿泉水";
    document.write(opeel.innerText);
    document.write("<br>");
    document.write(document.getElementById("op").value);
</script>